package org.hydrakyoufeng.stuplatform.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.hydrakyoufeng.stuplatform.service.EchartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("echarts")
@Tag(name = "echarts报表")
public class EchartsController {

    @Autowired
    private EchartsService echartsService;

    /**
     * 查询用户注册报表数据
     * @param type
     * @return
     * @throws Exception
     */
    @GetMapping("queryUserList/{type}")
    public ResponseEntity queryUserList(@PathVariable String type) throws Exception  {
        return ResponseEntity.ok(echartsService.queryUserList(type));
    }

    /**
     * 查询课程章节数量前10的数据
     * @return
     * @throws Exception
     */
    @GetMapping("queryCourseList")
    public ResponseEntity queryCourseList() throws Exception  {
        return ResponseEntity.ok(echartsService.queryCourseList());
    }
}
